package com.ruoyi.web.controller.cashier;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SySelfServiceBookingOrderLog;
import com.ruoyi.system.domain.SyTraditionalReservation;
import com.ruoyi.system.dto.SySelfBookingRefundOrderLogDTO;
import com.ruoyi.system.service.SySelfServiceBookingOrderLogService;
import com.ruoyi.system.util.BaseResponse;
import com.ruoyi.system.util.StoreIdUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/booking-log")
@Api(tags = "预定-自助预定-操作记录管理")
public class SySelfServiceBookingOrderLogController extends BaseController {

    @Autowired
    private SySelfServiceBookingOrderLogService sySelfServiceBookingOrderLogService;

    @Autowired
    private StoreIdUtils storeIdUtils;

    @GetMapping("/{id}")
    @ApiOperation("根据ID获取操作记录详情")
    public SySelfServiceBookingOrderLog getById(@PathVariable Long id) {
        return sySelfServiceBookingOrderLogService.getById(id);
    }

    @PostMapping("/save")
    @ApiOperation("新增操作记录")
    public boolean create(@RequestBody SySelfServiceBookingOrderLog log) {
        return sySelfServiceBookingOrderLogService.add(log);
    }

    @PutMapping("/update")
    @ApiOperation("更新操作记录")
    public boolean update(@RequestBody SySelfServiceBookingOrderLog log) {
        return sySelfServiceBookingOrderLogService.updateById(log);
    }

    @PostMapping("/page")
    @ApiOperation("获取所有操作记录列表")
    public BaseResponse<IPage<SySelfServiceBookingOrderLog>> getAll(SySelfBookingRefundOrderLogDTO logDTO) {
        IPage<SySelfServiceBookingOrderLog> all = sySelfServiceBookingOrderLogService.all(logDTO);
        return BaseResponse.success(all);
    }
}
